package com.wxq.blog.controller;

import com.wxq.blog.common.aop.LogAnnotation;
import com.wxq.blog.service.TagService;
import com.wxq.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("tags")
public class TagsController {
    @Autowired
    private TagService tagService;
    @GetMapping
    @LogAnnotation(module = "标签",operation = "查询文章所有标签")//加入aop切面输出日志
    public Result findAll(){
        /**
         * 查询所有的文章标签
         * @return
         */
        return tagService.findAll();
    }
    @GetMapping("detail")
    @LogAnnotation(module = "标签",operation = "查询文章所有标签详情")//加入aop切面输出日志
    public Result findAllDetail(){
        return tagService.findAllDetail();
    }
    @GetMapping("detail/{id}")
    @LogAnnotation(module = "标签",operation = "查询所有文章标签下所有的文章")//加入aop切面输出日志
    public Result findADetailById(@PathVariable("id") Long id){
        /**
         * 查询所有文章标签下所有的文章
         * @return
         */
        return tagService.findADetailById(id);
    }

}
